<?php 
class Admin_Model_Portlet extends Me_Model_Action
{
	function init(){

		$this->_name    = 'portlet';
		$this->_primary = 'id';
	}
	
	/**
	 * @param id $panelPageId
	 * @return array list of portlet in panel
	 * @author Tai Tran <tai@uniweb.vn>
	 */
	function getPortletByPanelPage($panelPageId)
	{
		$selector = $this->select('porlet_id, path, portlet_in_panel.name, style, number')->setIntegrityCheck(FALSE)
				->from('portlet_in_panel')
				->join('portlet', 'portlet.id = portlet_in_panel.portlet_id')
				->where('portlet_in_panel.id = ?', $panelPageId)
				->order('number');
		
		$query = $this->fetchAll($selector)->toArray();
		return $query;
	}
} 
